<template>
  <div>
    <!-- 移动商城首页，底部商品栏的组件 -->
    <div class="floor">
      <div class="floor-title">{{floorTitle}}</div>
      <div class="floor-anomalyLeft" v-if="location!=='right'">
        <div class="floor1-left">
          <img :src="floorData0.image" />
        </div>
        <div>
          <div class="floor1-right-top">
            <img :src="floorData1.image" />
          </div>
          <div>
            <img :src="floorData2.image" />
          </div>
        </div>
      </div>
      <div class="floor-anomalyRight" v-if="location==='right'">
        <div>
          <div class="floor1-left-top">
            <img :src="floorData1.image" />
          </div>
          <div>
            <img :src="floorData2.image" />
          </div>
        </div>
        <div class="floor1-right">
          <img :src="floorData0.image" />
        </div>
      </div>
      <div class="floor-rule">
        <div class="floor-item" v-for="(item, index) of floorData.slice(1)" :key="index">
          <img :src="item.image" width="100%" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'FloorGoods',
    props: ['floorData', 'floorTitle', 'location'],
    data() {
      return {
        floorData0: {},   //楼层1的数据
        floorData1: {},   //楼层1的数据
        floorData2: {},   //楼层1的数据
      }
    },
    watch: {
      floorData(val) {
        this.floorData0=this.floorData[0]
        this.floorData1=this.floorData[1]
        this.floorData2=this.floorData[2]
      }
    }
  }
</script>

<style lang="stylus" scoped>
@import '~@/assets/css/common.styl';
.floor {
  .floor-title {
    text-align:center;
    font-size:14px;
    height: 1.8rem;
    line-height: 1.8rem;
  }

  .floor-anomalyLeft {
    display: flex;
    flex-direction: row;
    div {
      flex: 1;
      box-sizing: border-box;
      img { width:100%; }
    }

    .floor1-left { border-right:1px solid $colorB; }
    .floor1-right-top {
      border-bottom:1px solid $colorB;
      height: 5.26rem;
      &+div { height: 5.08rem; overflow: hidden; }
    }
  }
  .floor-anomalyRight {
    display: flex;
    flex-direction: row;
    div {
      flex: 1;
      box-sizing: border-box;
      img { width:100%; }
    }

    .floor1-right { border-left:1px solid $colorB; }
    .floor1-left-top {
      border-bottom:1px solid $colorB;
      height: 5.26rem;
      &+div { height: 5.08rem; overflow: hidden; }
    }
  }

  .floor-rule {
    display: flex;
    flex-wrap: wrap;
    background-color: #ffffff;
    .floor-item {
      width: 10rem;
      box-sizing: border-box;
      &:nth-of-type(odd) {
        border-right: 1px solid $colorB;
      }
      &:nth-of-type(n+2) {
        border-top: 1px solid $colorB;
      }
    }
  }
}
</style>